home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
- COPY(QUEL) 1/19/79 COPY(QUEL)
-
-
-
- NAME
- copy - copy data into/from a relation from/into a UNIX file.
-
- SYNOPSIS
- _c_o_p_y relname (domname = format {, domname = format })
- direction "filename"
-
- DESCRIPTION
- _C_o_p_y moves data between INGRES relations and standard UNIX
- files. _R_e_l_n_a_m_e is the name of an existing relation. In
- general _d_o_m_n_a_m_e identifies a domain in _r_e_l_n_a_m_e. _F_o_r_m_a_t in-
- dicates the format the UNIX file should have for the
- corresponding domain. _D_i_r_e_c_t_i_o_n is either _i_n_t_o or _f_r_o_m.
- _F_i_l_e_n_a_m_e is the full UNIX pathname of the file.
-
- On a copy _f_r_o_m a file to a relation, the relation cannot
- have a secondary index, it must be owned by you, and it must
- be updatable (not a secondary index or system relation).
-
- _C_o_p_y cannot be used on a relation which is a view. For a
- copy _i_n_t_o a UNIX file, you must either be the owner of the
- relation or the relation must have retrieve permission for
- all users, or all permissions for all users.
-
- The formats allowed by copy are:
-
- _i_1,_i_2,_i_4 - The data is stored as an integer of length 1, 2,
- or 4 bytes in the UNIX file.
-
- _f_4,_f_8 - The data is stored as a floating point number (ei-
- ther single or double precision) in the UNIX file.
-
- _c_1,_c_2,...,_c_2_5_5 - The data is stored as a fixed length string
- of characters.
-
- _c_0 - Variable length character string.
-
- _d_0,_d_1,...,_d_2_5_5 - Dummy domain.
-
- Corresponding domains in the relation and the UNIX file do
- not have to be the same type or length. _C_o_p_y will convert
- as necessary. When converting anything except character to
- character, _c_o_p_y checks for overflow. When converting from
- character to character, _c_o_p_y will blank pad or truncate on
- the right as necessary.
-
- The domains should be ordered according to the way they
- should appear in the UNIX file. Domains are matched accord-
- ing to name, thus the order of the domains in the relation
- and in the UNIX file does not have to be the same.
-
- _C_o_p_y also provides for variable length strings and dummy
- domains. The action taken depends on whether it is a copy
- _i_n_t_o or a copy _f_r_o_m. Delimitors for variable length strings
- and for dummy domains can be selected from the list of:
-
- _n_l - new line character
- _t_a_b - tab character
- _s_p - space
- _n_u_l or _n_u_l_l - null character
- _c_o_m_m_a - comma
- _c_o_l_o_n - colon
- _d_a_s_h - dash
- _l_p_a_r_e_n - left parenthesis
- _r_p_a_r_e_n - right parenthesis
- _x - any single character 'x'
-
- The special meaning of any delimitor can be turned off by
- preceeding the delimitor with a `\'. The type specifier can
- optionally be in quotes ("c0delim"). This is usefully if
- you wish to use a single character delimitor which has spe-
- cial meaning to the QUEL parser.
-
- When the _d_i_r_e_c_t_i_o_n is from, _c_o_p_y appends data into the rela-
- tion _f_r_o_m the UNIX file. Domains in the INGRES relation
- which are not assigned values from the UNIX file are as-
- signed the default value of zero for numeric domains, and
- blank for character domains. When copying in this direction
- the following special meanings apply:
-
- _c_0_d_e_l_i_m - The data in the UNIX file is a variable length
- character string terminated by the delimitor _d_e_l_i_m. If
- _d_e_l_i_m is missing then the first comma, tab, or newline
- encountered will terminate the string. The delimitor
- is not copied.
-
- For example:
- pnum=c0 - string ending in comma, tab, or nl.
- pnum=c0nl - string ending in nl.
- pnum=c0sp - string ending in space.
- pnum=c0z - string ending in the character `z'.
- pnum="c0%" - string ending in the character `%'.
-
- A delimitor can be escaped by preceeding it with a `\'.
- For example, using _n_a_m_e = _c_0, the string ``Blow\,
- Joe,'' will be accepted into the domain as ``Blow,
- Joe''.
-
- _d_0_d_e_l_i_m - The data in the UNIX file is a variable length
- character string delimited by _d_e_l_i_m. The string is
- read and discarded. The delimitor rules are identical
- for _c_0 and _d_0. The domain name is ignored.
-
- _d_1,_d_2,...,_d_2_5_5 - The data in the UNIX file is a fixed length
- character string. The string is read and discarded.
- The domain name is ignored.
-
- When the direction is _i_n_t_o, _c_o_p_y transfers data _i_n_t_o the
- UNIX file from the relation. If the file already existed,
- it is truncated to zero length before copying begins. When
- copying in this direction, the following special meanings
- apply:
-
- _c_0 - The domain value is converted to a fixed length charac-
- ter string and writted into the UNIX file. For charac-
- ter domains, the length will be the same as the domain
- length. For numeric domains, the standard INGRES
- conversions will take place as specified by the `-_i',
- `-_f', and `-_c' flags (see ingres(unix)).
-
- _c_0_d_e_l_i_m - The domain will be converted according to the
- rules for _c_0 above. The one character delimitor will
- be inserted immediately after the domain.
-
- _d_1,_d_2,...,_d_2_5_5 - The domain name is taken to be the name of
- the delimitor. It is written into the UNIX file 1 time
- for _d_1, 2 times for _d_2, etc.
-
- _d_0 - This format is ignored on a copy _i_n_t_o.
-
- _d_0_d_e_l_i_m - The _d_e_l_i_m is written into the file. The domain
- name is ignored.
-
-
- If no domains appear in the copy command (i.e. copy relname
- () into/from "filename") then _c_o_p_y automatically does a
- ``bulk'' copy of all domains, using the order and format of
- the domains in the relation. This is provided as a con-
- venient shorthand notation for copying and restoring entire
- relations.
-
- To _c_o_p_y into a relation, you must be the owner or all users
- must have all permissions set. Correspondingly, to _c_o_p_y
- from a relation you must own the relation or all users must
- have at least retrieve permission on the relation. Also,
- you may not _c_o_p_y a view.
-
- EXAMPLE
- /* Copy data into the emp relation */
- copy emp (name=c10,sal=f4,bdate=i2,mgr=c10,xxx=d1)
- from "/mnt/me/myfile"
-
- /* Copy employee names and their salaries into a file */
- copy emp (name=c0,comma=d1,sal=c0,nl=d1)
- into "/mnt/you/yourfile"
-
- /* Bulk copy employee relation into file */
- copy emp ()
- into "/mnt/ours/ourfile"
-
- /* Bulk copy employee relation from file */
- copy emp ()
- from "/mnt/thy/thyfile"
-
- SEE ALSO
- append(quel), create(quel), quel(quel), permit(quel),
- view(quel), ingres(unix)
-
- BUGS
- _C_o_p_y stops operation at the first error.
-
- When specifying _f_i_l_e_n_a_m_e, the entire UNIX directory pathname
- must be provided, since INGRES operates out of a different
- directory than the user's working directory at the time
- INGRES is invoked.
-
-